{{- $version := .Get 0 -}}
{{- $url := printf "https://github.com/hugo-fixit/FixIt/releases/tag/v%v" $version -}}
{{- $type := .Get 1 | default "new" | lower -}}
{{- $label := T (printf "version.%v" $type) -}}
{{- $color := cond (eq $type "changed") "ff9101" "00b1ff" | cond (eq $type "deleted") "ff5252" -}}
{{- $pathTemplate := cond .Site.IsMultiLingual (printf "images/version/%%v-%%v.%v.svg" .Page.Language.Lang) "images/version/%v-%v.svg" -}}
{{- $path := printf $pathTemplate $version $type -}}
{{- $resource := resources.Get "images/version.template.svg" -}}
{{- $resource = $resource | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color "isCJK" .Page.Params.IsCJKLanguage) | minify -}}
{{- $alt := printf "FixIt %v | %v" $version $label -}}
<a href="{{ $url }}" rel="external nofollow noopener noreferrer" target="_blank">
  {{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/image.html" -}}
</a>
{{- /* EOF */ -}}
